﻿/*****************************************************************//**
 * @file    FITKAcousticsVTKGraphObjectSEAJunctionLine.h
 * @brief   Graph object for SEA junction line data.
 *  
 * @author  ChengHaotian (yeguangbaozi@foxmail.com)
 * @date    2024-11-15
 *********************************************************************/

#ifndef __FITKACOUSTICSVTKGRAPHOBJECTSEAJUNCTIONLINE_H__
#define __FITKACOUSTICSVTKGRAPHOBJECTSEAJUNCTIONLINE_H__

#include "FITKAcousticsVTKGraphObjectSEAJunction.h"

#include "FITKAcousticsVTKGraphAdaptorAPI.h"

// Forward declaration
class vtkUnstructuredGrid;
class vtkPoints;
class vtkTubeFilter;

class FITKAcousticsVTKGraphActor;

namespace Acoustics
{
    class FITKSEAJunctionLine;
    class FITKAcousticsSEANodeList;
}

namespace Exchange
{
    class FITKAcousticsVTKGraphObjectSelect;
}

namespace Exchange
{
    /**
     * @brief   Graph object for 'SEA junction line'.
     * @author  ChengHaotian (yeguangbaozi@foxmail.com)
     * @date    2024-11-15
     */
    class FITKACOUSTICSGRAPHADAPTORAPI FITKAcousticsVTKGraphObjectSEAJunctionLine : public FITKAcousticsVTKGraphObjectSEAJunction
    {
        // Regist
        FITKGraphObjectRegist(FITKAcousticsVTKGraphObjectSEAJunctionLine, FITKAcousticsVTKGraphObjectSEAJunction);
        FITKCLASS(Exchange, FITKAcousticsVTKGraphObjectSEAJunctionLine);

    public:
        /**
         * @brief   Constructor.
         * @param   jLine: The junction line data
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-15
         */
        FITKAcousticsVTKGraphObjectSEAJunctionLine(Acoustics::FITKSEAJunctionLine* jLine);

        /**
         * @brief   Destructor.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-15
         */
        ~FITKAcousticsVTKGraphObjectSEAJunctionLine();

        /**
         * @brief   Update the visibility with data object's visibility.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-15
         */
        void updateVisibility() override;

    private:
        /**
         * @brief   Intialize.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-15
         */
        void init() override;

        /**
         * @brief   Generate the vtkDataSet for the junction.[override]
         * @param   junction: The junction data
         * @return  Is the data valid
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-15
         */
        bool generateDataSet(Acoustics::FITKAbstractJunction* junction) override;

        /**
         * @brief   Generate the actor with the junction data.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-15
         */
        void generateGraph() override;

        /**
         * @brief   Update the tube radius by the boundary of all SEA nodes.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-15
         */
        void updateGlyphSizeByRatio() override;

    private:
        /**
         * @brief   The radius of the tube.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-15
         */
        double m_tubeRadius = 30.;

        /**
         * @brief   The tube filter for the junction line.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-15
         */
        vtkTubeFilter* m_tubeFilter{ nullptr };

    };
}   // namespace Exchange

#endif // __FITKACOUSTICSVTKGRAPHOBJECTSEAJUNCTIONLINE_H__
